package com.example.demo.domain.base;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * @author Jack
 * @Title: 所有实体的父类
 * @Description: 所有实体的父类
 * @date 2018年1月7日13:57:05
 */
@MappedSuperclass
public abstract class BaseEntity implements Serializable {

    private static final long serialVersionUID = -4742379522421238421L;

    public Long id;

    /* 实体的状态 */
    public int status;

    /* 创建的时间 */
    public Long createTime;

    /* 修改时间 */
    public Long lastModifyTime;

    /* 是否有效,1:有效，-1无效 */
    public int validFlag = 1;

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Column(name = "create_time")
    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    @Column(name = "last_modify_time")
    public Long getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Long lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    @Column(name = "valid_flag")
    public int getValidFlag() {
        return validFlag;
    }

    public void setValidFlag(int validFlag) {
        this.validFlag = validFlag;
    }

    public abstract boolean valid();
}
